import { createRouter, createWebHistory } from 'vue-router'
// 一级路由
import home from '../views/home/home.vue'
import zhuce from '../views/home/zhuce/zhuce.vue'
import denglu from '../views/home/denglu/denglu.vue'
// 二级路由
import index from '../views/home/children/index.vue'
import cla from '../views/home/children/cla.vue'
import cart from '../views/home/children/cart.vue'
import my from '../views/home/children/my.vue'
import jjb from '../views/home/children/jjb.vue'
const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    // 重定向
    {
      path: '/',
      redirect: '/home/index'
    },

    {
      path: '/zhuce',
      name: 'zhuce',
      component: zhuce,
    },
    {
      path: '/denglu',
      name: 'denglu',
      component: denglu,
    },
    {
      path: '/home',
      name: 'home',
      component: home,
      children: [
        {
          path: 'index',
          name: 'index',
          component: index,
        },

          {
          path: 'cla',
          name: 'cla',
          component: cla,
        },

          {
          path: 'cart',
          name: 'cart',
          component: cart,
        },

          {
          path: 'my',
          name: 'my',
          component: my,
        },

          {
          path: 'jjb',
          name: 'jjb',
          component: jjb,
        },
      ]
    },

  ],
})

export default router
